# 01-05-19    HME   Modified build instructions to accomodate C99 mode
# 01-26-19    HME   Added "-fPIC" for Fedora 64-bit builds of LDAhid.o
# 04-22-19    RD    Changes for FC19 testing
all : test LDAhid.o profile_test

# How we create LDAhid.o
LDAhid.o : LDAhid.c LDAhid.h
#	gcc -std=c99 -lm -o LDAhid.o -c LDAhid.c -I/usr/include/libusb-1.0 -lusb -lusb-1.0
# The following line works for Debian
#	gcc -lm -o LDAhid.o -c LDAhid.c -I/usr/include/libusb-1.0 -lusb -lusb-1.0
# The following line is required for 64-bit Fedora
#	gcc -lm -o LDAhid.o -c LDAhid.c -fPIC -I/usr/include/libusb-1.0 -lusb -lusb-1.0
#	gcc -g -lm -o LDAhid.o -c LDAhid.c -fPIC -lusb-1.0
	gcc -o LDAhid.o -c LDAhid.c -I/usr/include/libusb-1.0 -L/lib/arm-linux-gnueabihf/libusb-1.0 -lusb-1.0 -lm

# The final output is one or more linked object files
test : test.c LDAhid.o LDAhid.h
#	gcc -std=c99 -o test -lpthread -I/usr/include/libusb-1.0 -L/usr/lib/libusb-1.0 -lusb-1.0 test.c LDAhid.o  -lm
#	gcc -std=c99 -o test test.c LDAhid.o -pthread -I/usr/include/libusb-1.0 -L/usr/lib/libusb-1.0 -lusb-1.0 -lm
#	gcc -o test test.c LDAhid.o -pthread -I/usr/include/libusb-1.0 -L/usr/lib64/libusb-1.0 -lusb-1.0 -lm
#	gcc -g -o test test.c LDAhid.o -pthread -lusb-1.0 -lm
	gcc -o test test.c LDAhid.o -pthread -I/usr/include/libusb-1.0 -L/lib/arm-linux-gnueabihf/libusb-1.0 -lusb-1.0 -lm

# The final output is one or more linked object files
profile_test : profile_test.c LDAhid.o LDAhid.h
#	gcc -g -o profile_test profile_test.c LDAhid.o -pthread -lusb-1.0 -lm
	gcc -o profile_test profile_test.c LDAhid.o -I/usr/include/libusb-1.0 -L/lib/arm-linux-gnueabihf/libusb-1.0 -pthread -lusb-1.0 -lm

clean :
	rm -f LDAhid.o
	rm -f test
	rm -f profile_test

